//
// Created by zengao on 2022/12/29.
//

#ifndef C100_CODEGEN_H
#define C100_CODEGEN_H

#include "AstNode.h"

namespace C100 {
    class CodeGen : public AstVisitor {
    private:
        int stackLever{0};
        int sequence{0};
    public:
        CodeGen() {}

        void visitorProgramNode(ProgramNode *node) override;

    private:
        void visitorBinaryNode(BinaryNode *node) override;

        void visitorConstantNode(ConstantNode *node) override;

        void visitorIfStmtNode(IfStmtNode *node) override;

        void visitorExprStmtNode(ExprStmtNode *node) override;

        void visitorBlockStmtNode(BlockStmtNode *node) override;

        void visitorAssignExprNode(AssignExprNode *node) override;

        void visitorVarExprNode(VarExprNode *node) override;

        void push();

        void pop(const char *reg);
    };
}


#endif //C100_CODEGEN_H
